package com.cos.demo4.advice;

import org.springframework.aop.ThrowsAdvice;

import java.lang.reflect.Method;
import java.util.Date;

/**
 * @author: COS
 * @time: 2021/5/17 17:20
 * @description: 异常增强
 */
public class ExceptionAdvice implements ThrowsAdvice {
    public void afterThrowing(Method method, Object[] args, Object target, Exception ex){
        System.out.print("异常日志记录"+new Date()+",出现异常的类是"+method.getName());
        System.out.println(",异常信息是"+ex.getMessage());
    }
}
